package com.handsome.观察者模式;

/**
 * @author niechun
 * @date 2023/3/19 16:14
 */
public class Client {
    public static void main(String[] args) {
        WeatherDataSubject weatherDataSubject=new WeatherDataSubject();

        //创建一个观察者
        Observer baiduObserver=new BaiduObserver();
        Observer sinaObserver=new SinaObserver();

        //注册观察者
        weatherDataSubject.register(baiduObserver);
        weatherDataSubject.register(sinaObserver);

        //当天气数据发生变化
        weatherDataSubject.changeData("37℃","1018hPa","50%");

    }
}
